<?php
//format the second

class timeFormat {
    private static $instance = NULL;

    static public function getinstance() {
		if(self::$instance == NULL)
			self::$instance = new timeFormat();
		return self::$instance;        
    }

    public function hourMinSec($times) {
        $days = ($times>=86400) ? floor($times/86400) : 0;
        $time = $times-86400*$days;
        $hour = (($time)>3600 && ($time)<86400) ? floor(($time)/3600) : 0;
        $time = $times-86400*$days-3600*$hour;
        $minute = ($time>=60 && $time<3600) ? floor(($time)/60) : 0;
        $time = $times-86400*$days-3600*$hour-60*$minute;
        $second = ($time>0 && $time<60) ? $time : 0;
        /**
        $hour = ($hour>9) ? $hour : '0'.$hour;
        $minute = ($minute>9) ? $minute : '0'.$minute;
        $second = ($second>9) ? $second : '0'.$second;
        */
        $str = $hour.'h'.$minute.'m'.$second.'s';
        return $str;
    }

 
}

?>